<?php

namespace app\common\model;

use think\Db;
use think\Model;

class Address extends Model{
    protected $pk = 'id';

    protected $name = 'address';

    /**
     * 获取地址列表
     */
    public static function getUserAddressList($user_id=0){
        $addressList=Db::name('address')
            ->where(['user_id' => $user_id])
            ->whereNull('delete_time')
            ->order('is_default desc')
            ->paginate(15);
        return $addressList;
    }    /**
     * 获取地址列表
     */
    public static function getUserAddressListIos($user_id=0){
        $addressList=Db::name('pg_address')
            ->where(['user_id' => $user_id])
            ->whereNull('delete_time')
            ->order('is_default desc')
            ->select();
        return $addressList;
    }
}